#include "ThreadPool.h"
#include <iostream>
#include "Sum.h"

int num = 0;
int times = 500;
int loop = 10;
CRITICAL_SECTION criticalSection;
int main(int argc, char *argv[])
{
	if(argc != 3) 
	{
		times = 10;
		loop = 10;
	}
	else
	{
		times = atoi(argv[1]);
		loop = atoi(argv[2]); 
	}
	InitializeCriticalSection(&criticalSection);
	LARGE_INTEGER BegainTime ;     
    LARGE_INTEGER EndTime ;     
    LARGE_INTEGER Frequency ;     
    QueryPerformanceFrequency(&Frequency);     
    QueryPerformanceCounter(&BegainTime) ;

	ThreadPool pool;
	Sum sum;
	for(int i =0; i< times; i++)
	{
		pool.Start(&sum);
	}
	
	while(num < times*loop)
	{
		
	}

	QueryPerformanceCounter(&EndTime); 
	std::cout<<(double)( EndTime.QuadPart - BegainTime.QuadPart )/ Frequency.QuadPart <<endl;
	return 0;
}